package com.wc.算法基础课.D第四讲数学知识.博弈论.集合_Nim游戏;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/1/24 16:24
 * @description https://www.acwing.com/problem/content/895/
 */
public class Main {
    static int N = 100, M = 10010;
    static int[] s = new int[N];
    static int[] f = new int[M];
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int n, k, x;

    public static void main(String[] args) {
        int res = 0;
        k = sc.nextInt();
        Arrays.fill(f, -1);
        for (int i = 1; i <= k; i++) {
            s[i] = sc.nextInt();
        }
        n = sc.nextInt();
        for (int i = 1; i <= n; i++) {
            x = sc.nextInt();
            res ^= sg(x);
        }
        if (res != 0) {
            out.println("Yes");
        } else {
            out.println("No");
        }
        out.flush();
    }

    static int sg(int x) {
        if (f[x] != -1) return f[x];

        Set<Integer> set = new HashSet<>();
        for (int i = 1; i <= k; i++) {
            if (x >= s[i]) {
                set.add(sg(x - s[i]));
            }
        }
        for (int i = 0; ; i++) {
            if (!set.contains(i)) {
                return f[x] = i;
            }
        }
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}